#ifndef __MYMEMORY_H__
#define __MYMEMORY_H__

#include <stddef.h>

class MyMemory {
public:
	class Garbage {
	public:
		~Garbage() {
			if(MyMemory::instance_) {
				delete MyMemory::instance_;
				MyMemory::instance_ = NULL;
			}
		}
	};

	~MyMemory();

	static MyMemory* GetInstance() {
		if(instance_ == NULL) {
			if(instance_ == NULL) {
				instance_ = new MyMemory();
				static Garbage garbage;
			}
		}
		return instance_;
	}

	void *AllocMemory(int mem_countm, bool if_mem_set);
	void FreeMemory(void *point);



private:
	MyMemory();
	static MyMemory *instance_;
};


#endif
